Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Host and TLSContext to configure a CRL (v2.3) #4247

Merged
merged 4 commits into from
May 26, 2022

Conversation

alexgervais
Copy link
Contributor

@alexgervais alexgervais commented May 25, 2022

Signed-off-by: alex [email protected]

Description

Allow Host and TLSContext to configure a CRL through the crl_secret property on both resources.

Related Issues

https://github.com/datawire/apro/issues/2619

Testing

Manual tests and automated KAT tests for the Host resource.

Checklist

  • I made sure to update CHANGELOG.md.

    Remember, the CHANGELOG needs to mention:

    • Any new features
    • Any changes to our included version of Envoy
    • Any non-backward-compatible changes
    • Any deprecations
  • This is unlikely to impact how Ambassador performs at scale.

    Remember, things that might have an impact at scale include:

    • Any significant changes in memory use that might require adjusting the memory limits
    • Any significant changes in CPU use that might require adjusting the CPU limits
    • Anything that might change how many replicas users should use
    • Changes that impact data-plane latency/scalability
  • My change is adequately tested.

    Remember when considering testing:

    • Your change needs to be specifically covered by tests.
      • Tests need to cover all the states where your change is relevant: for example, if you add a behavior that can be enabled or disabled, you'll need tests that cover the enabled case and tests that cover the disabled case. It's not sufficient just to test with the behavior enabled.
    • You also need to make sure that the entire area being changed has adequate test coverage.
      • If existing tests don't actually cover the entire area being changed, add tests.
      • This applies even for aspects of the area that you're not changing – check the test coverage, and improve it if needed!
    • We should lean on the bulk of code being covered by unit tests, but...
    • ... an end-to-end test should cover the integration points
  • I updated DEVELOPING.md with any any special dev tricks I had to use to work on this code efficiently.

  • The changes in this PR have been reviewed for security concerns and adherence to security best practices.

@alexgervais alexgervais marked this pull request as ready for review May 25, 2022 20:56
Copy link
Member

@Alice-Lilith Alice-Lilith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this change! Looks good to me, but do we maybe want to change crl_secret to something like:

crl:
  secretName: string

Instead so that way we are leaving ourselves room for additional properties/fields should we add additional fields around the CRLs? I know Envoy exposes multiple options for handling them, so I could see us wanting to add more CRL fields to the CRDs in the future. @LanceEa Thoughts?

Copy link
Contributor

@LanceEa LanceEa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks pretty good. Just a few questions and comments.

@LanceEa
Copy link
Contributor

LanceEa commented May 26, 2022

Thanks for making this change! Looks good to me, but do we maybe want to change crl_secret to something like:

crl:
  secretName: string

Instead so that way we are leaving ourselves room for additional properties/fields should we add additional fields around the CRLs? I know Envoy exposes multiple options for handling them, so I could see us wanting to add more CRL fields to the CRDs in the future. @LanceEa Thoughts?

Good call @AliceProxy, I would agree that we should set ourselves up for future enhancements. In general, we need to start planning out our road to a proper CRD V3.

I would also say at a minimum we should be consistent with the casings of our fields. Based on our docs it should be camelCasing, correct?

@alexgervais
Copy link
Contributor Author

I agree with you @AliceProxy and @LanceEa. tls.crl.secretName would be desirable both in terms of casing and consistency with how CRDs should be defined. We should aim for this in v3. However, I took a look at the other existing TLS fields:

tls:
  cert_chain_file:    # string
  private_key_file:   # string
  ca_secret:          # string
  cacert_chain_file:  # string
  alpn_protocols:     # string
  cert_required:      # bool
  min_tls_version:    # string
  max_tls_version:    # string
  cipher_suites:      # array of strings
  ecdh_curves:        # array of strings
  sni:                # string

So I went for consistency in the way current resources are defined... snake case and _secret suffix.
Does it make sense?

@Alice-Lilith
Copy link
Member

Alice-Lilith commented May 26, 2022

@alexgervais @LanceEa

I would also say at a minimum we should be consistent with the casings of our fields. Based on our docs it should be camelCasing, correct?

So one of our goals for the V3 CRDs is to move everything to camelCase since we currently have a mix of snake_case and camelCase all over the CRDs and camelCase is more "kubelike". Having it be snake_case for this PR not a big problem because with the V3 CRDs we can convert it to camelCase.

If we want to go with snake_case for this version, then I still think it would be beneficial to do something like:

crls:
   secret_name: string

because if we add new fields in the V3 CRDs, then we have to support those fields in the older CRD versions for round tripping conversion and that would make it simpler to add values into the object instead of having a V3 CRD that looks like:

  crls:
    secretName: string
    newField1: string
    newField2: string

and then have the v3alpha1/v2 CRDs look like this after conversion if we merge this as crl_secret: string:

  crl_secret: string
  new_field_1:  string
  new_field_2: string

Does that reasoning make sense?

As for the casing, we currently have some CRDs that use all snake_case, some that use all camelCase, and some that have a mix, so I'm not as picky about the casing for this PR since we will be standardizing the casing in the V3 CRDs.

@alexgervais
Copy link
Contributor Author

Thanks for all your thoughts. I'm very much aligned with the CRD design for v3.
As for the current version, I still think we should keep the tls config block flat, as other keys also reference either a _secret or _file.
I am slightly afraid people would think of using the following example as an array of CRLs, even tho only 1 entry can be specified (per CA/Host/TLSContext).

crls:
   secret_name: string

Seeing how things are handled in the python code, I saw examples where we would take the CA chain from either a _secret or _file reference. If we need to extend the CRL to file, we could reuse that logic.

@LanceEa
Copy link
Contributor

LanceEa commented May 26, 2022

@AliceProxy - I'm ok with @alexgervais reasoning but I haven't felt all the pains the team might have in the past so If you feel strong about this then try to convince him otherwise 😄 . If not let's move forward and get this merged so we can focus on release activities.

@alexgervais alexgervais merged commit 4db1262 into release/v2.3 May 26, 2022
@alexgervais alexgervais deleted the alexgervais/dev/crl-v2.3 branch May 26, 2022 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants